﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wwtfly.BBS.BackModels.Models.News;
using Wwtfly.BBS.BackBLL.News;
using Wwtfly.BBS.BackModels.Models.NewsType;

namespace Wwtfly.BBS.ForeApplication.WebForm
{
    public partial class NewShows : System.Web.UI.Page
    {
        protected static NewsTypesModel newType8 = null;
        protected NewsShowsModel newshows = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string newid = "";
                try
                {
                    newid = Request.Params["newactionId"].ToString();
                }
                catch (Exception)
                {
                    newid = "";
                }
                newshows = NewsBLL.GetInfo(AsInt(newid, 0));

                newType8 = NewTypesBLL.GetInfo(8);
                if (newType8 != null)
                {
                    this.Repeaternew1.DataSource = NewsBLL.NewsList(10, NewTypesBLL.GetInfo(newType8.Id).Id);
                    this.Repeaternew1.DataBind();
                }

            }
        }

        /// <summary>
        /// 转换成 Int32
        /// </summary>
        /// <param name="s">要转换的参数</param>
        /// <param name="defaultValue">转换失败缺省值</param>
        /// <returns>Int32</returns>
        public Int32 AsInt(string s, int defaultValue)
        {
            int result = defaultValue;
            return int.TryParse(s, out result) ? result : defaultValue;
        }
   
    }
}